package com.ss.android.article.browser.c;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v4.content.ContextCompat;
import android.util.TypedValue;

import com.ss.android.article.browser.R;

public final class g {
    static {
        new TypedValue();
    }

    @NonNull public static Bitmap a(@NonNull Context arg8) {
        int v1 = ContextCompat.getColor(arg8, R.color.ku);
        Drawable v0 = ContextCompat.getDrawable(arg8, R.drawable.ff);
        if(Build.VERSION.SDK_INT < 21) {
            v0 = DrawableCompat.wrap(v0).mutate();
        }

        Bitmap v2 = Bitmap.createBitmap(v0.getIntrinsicWidth(), v0.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
        Canvas v3 = new Canvas(v2);
        v0.setBounds(0, 0, v3.getWidth(), v3.getHeight());
        v0.draw(v3);
        Bitmap v0_1 = Bitmap.createBitmap(v2.getWidth(), v2.getHeight(), Bitmap.Config.ARGB_8888);
        Paint v3_1 = new Paint();
        v3_1.setColorFilter(new PorterDuffColorFilter(v1, PorterDuff.Mode.SRC_IN));
        new Canvas(v0_1).drawBitmap(v2, 0f, 0f, v3_1);
        v2.recycle();
        return v0_1;
    }
}

